package initAll;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map.Entry;

import org.testng.annotations.DataProvider;

import fileConfig.readExcel;
import fileConfig.sheetData;

public class initData {

	@DataProvider(name="userKV")
	public Object[][] userKV(){
		return new Object[][] {
			{"18200708852","1q2w3e4r"}	
		};
	}
	
	@DataProvider(name="browser")
	public Object[] browser(){
		return new Object[]{"firefox","chrome"};
	}
	
	@DataProvider(name="loadlinks")
	public Object[][]loadlinks(){
		return new Object[][]{
			{"百度新闻","http://news.baidu.com/"},
			{"hao123","https://www.hao123.com/"},
			{"百度地图","https://map.baidu.com/"},
			{"百度直播","https://live.baidu.com/"},
			{"好看视频","https://haokan.baidu.com/?sfrom=baidu-top"},
			{"百度贴吧","https://tieba.baidu.com/index.html"}
		};
	}
	
	@DataProvider(name="staticElement")
	public Object[]staticElement(){
		readExcel re=new readExcel();
		HashMap<String,sheetData> excelData=re.readExcel("resource/webHomePageTest.xlsx");
		re.systemOutExcesData(excelData);
		System.out.println(sheetData.toString(excelData.get("Sheet1")));
		Object[] rowsData= new Object[excelData.get("Sheet1").getSheetData().size()];
		for(int i=0;i<excelData.get("Sheet1").getSheetData().size();i++) {
			rowsData[i]=excelData.get("Sheet1").getSheetData().get(i);
			for (Entry<String, Object> entry : ((HashMap<String, Object>) rowsData[i]).entrySet()) {
				System.out.print(entry.getKey()+"="+entry.getValue()+"  ");
			}
		}
		return rowsData;
	}
}
